package bb.lanxing.nav;

import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;

public interface INavigationService extends IInterface {
    boolean isNavigating() throws RemoteException;

    void registerCallback(INavigationServiceCallback callback) throws RemoteException;

    void startNavigation3(long lushuId) throws RemoteException;

    void stopNavigation() throws RemoteException;

    void unRegisterCallback(INavigationServiceCallback callback) throws RemoteException;

    void voiceSwitch(boolean open) throws RemoteException;

    abstract class Stub extends Binder implements INavigationService {
        private static final String DESCRIPTOR = "bb.lanxing.nav.INavigationService";
        static final int TRANSACTION_isNavigating = 1;
        static final int TRANSACTION_registerCallback = 2;
        static final int TRANSACTION_unRegisterCallback = 3;
        static final int TRANSACTION_startNavigation3 = 6;
        static final int TRANSACTION_stopNavigation = 7;
        static final int TRANSACTION_voiceSwitch = 8;

        @Override
        public IBinder asBinder() {
            return this;
        }

        public Stub() {
            attachInterface(this, DESCRIPTOR);
        }

        public static INavigationService asInterface(IBinder obj) {
            if (obj == null) {
                return null;
            }
            IInterface queryLocalInterface = obj.queryLocalInterface(DESCRIPTOR);
            if ((queryLocalInterface instanceof INavigationService)) {
                return (INavigationService) queryLocalInterface;
            }
            return new Proxy(obj);
        }

        @Override
        public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
            if (code == INTERFACE_TRANSACTION) {
                reply.writeString(DESCRIPTOR);
                return true;
            }
            switch (code) {
                case TRANSACTION_isNavigating -> {
                    data.enforceInterface(DESCRIPTOR);
                    boolean isNavigating = isNavigating();
                    reply.writeNoException();
                    reply.writeInt(isNavigating ? 1 : 0);
                    return true;
                }
                case TRANSACTION_registerCallback -> {
                    data.enforceInterface(DESCRIPTOR);
                    registerCallback(INavigationServiceCallback.Stub.asInterface(data.readStrongBinder()));
                    reply.writeNoException();
                    return true;
                }
                case TRANSACTION_unRegisterCallback -> {
                    data.enforceInterface(DESCRIPTOR);
                    unRegisterCallback(INavigationServiceCallback.Stub.asInterface(data.readStrongBinder()));
                    reply.writeNoException();
                    return true;
                }
                case TRANSACTION_startNavigation3 -> {
                    data.enforceInterface(DESCRIPTOR);
                    startNavigation3(data.readLong());
                    reply.writeNoException();
                    return true;
                }
                case TRANSACTION_stopNavigation -> {
                    data.enforceInterface(DESCRIPTOR);
                    stopNavigation();
                    reply.writeNoException();
                    return true;
                }
                case TRANSACTION_voiceSwitch -> {
                    data.enforceInterface(DESCRIPTOR);
                    voiceSwitch(data.readInt() != 0);
                    reply.writeNoException();
                    return true;
                }
                default -> {
                    return super.onTransact(code, data, reply, flags);
                }
            }
        }

        public static class Proxy implements INavigationService {
            public static INavigationService sDefaultImpl;
            private IBinder mRemote;

            Proxy(IBinder remote) {
                this.mRemote = remote;
            }

            @Override
            public IBinder asBinder() {
                return this.mRemote;
            }

            @Override
            public boolean isNavigating() throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    if (!this.mRemote.transact(TRANSACTION_isNavigating, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        return Stub.getDefaultImpl().isNavigating();
                    }
                    obtain2.readException();
                    return obtain2.readInt() != 0;
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public void registerCallback(INavigationServiceCallback callback) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeStrongBinder(callback != null ? callback.asBinder() : null);
                    if (!this.mRemote.transact(TRANSACTION_registerCallback, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        Stub.getDefaultImpl().registerCallback(callback);
                    } else {
                        obtain2.readException();
                    }
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public void unRegisterCallback(INavigationServiceCallback callback) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeStrongBinder(callback != null ? callback.asBinder() : null);
                    if (!this.mRemote.transact(TRANSACTION_unRegisterCallback, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        Stub.getDefaultImpl().unRegisterCallback(callback);
                    } else {
                        obtain2.readException();
                    }
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public void startNavigation3(long lushuId) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeLong(lushuId);
                    if (!this.mRemote.transact(TRANSACTION_startNavigation3, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        Stub.getDefaultImpl().startNavigation3(lushuId);
                    } else {
                        obtain2.readException();
                    }
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public void stopNavigation() throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    if (!this.mRemote.transact(TRANSACTION_stopNavigation, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        Stub.getDefaultImpl().stopNavigation();
                    } else {
                        obtain2.readException();
                    }
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }

            @Override
            public void voiceSwitch(boolean open) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeInt(open ? 1 : 0);
                    if (!this.mRemote.transact(TRANSACTION_voiceSwitch, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        Stub.getDefaultImpl().voiceSwitch(open);
                    } else {
                        obtain2.readException();
                    }
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }
        }

        public static INavigationService getDefaultImpl() {
            return Proxy.sDefaultImpl;
        }
    }
}